<!DOCTYPE html>
<html>
	<head>
		<meta charset="UTF-8">
		<title>美丽说</title>
		 <style type="text/css">
		 	.k0{
		 		display: none;
		 	}
		 </style>
		 <link rel="stylesheet" type="text/css" href="css/zhuce.css"/>
		 <script src="../day26/jquery-1.11.0.js" type="text/javascript" charset="utf-8"></script>
		 <script src="../js/cookie.js" type="text/javascript" charset="utf-8"></script>
		 <script type="text/javascript">
		 	$(function(){
		 		var iptn = $('.main .kk input');
		 	//	var t = iptn.eq(6).value();
		 		
		 		iptn.eq(6).click(function(){
		 			var use = iptn.eq(1).val();
		 			console.log(use);
		 			var pwd = iptn.eq(2).val();
		 			var opwd = iptn.eq(3).val();
		 			if(!use){
		 				alert("用户名不能为空！");
		 				return;
		 			}else if(!(/^[a-zA-Z][a-zA-z0-9]{5,15}$/g.test(use))){
		 				alert("你输入的用户名格式不正确！");
		 				return;
		 			}if(!pwd){
	  				alert("请输入密码!");
	  				return;
	  			}
	  			if(pwd!==opwd){
	  				alert("两次输入的密码不正确!");
	  				return;
	  			}
		 			//获取cookie
		 			var users = getCookie('rester') ? getCookie('rester'):"";
		 			users = create(users);
		 			if(use in users){
		 				alert("用户名已存在！");
		 				return;
		 			}else{
		 			users[use] = pwd;
		 			users = creates(users);
		 			setCookie('rester',users,7)
		 			alert("注册成功！");
		 			}
		 		});
		 		
		 	});
		function create(str){
			if(!str){
				return{}
			}else{
				var obj = {};
				var arr = str.split(";");
				for(var i = 0; i < arr.length; i++){
					var list = arr[i].split(":");
					obj[list[0]] = list[1];
				}
			}
			return obj;
		}
		function creates(obj){
			var str = '';
			for(var use in obj){
				var pwd = obj[use];
				if(str){
					str +=";";
				}
				str +=use +":" +pwd;
			}
			return str;
		}
		 </script>
	</head>
	<body>
		<!------------main----------------------------->
		<div class="top">
			<a href="index.html"><img  class = "logo" src="img/182326981374.png"/></a>
		</div>
		    <div class = "main">
		    	<div class ="box">
		    		<img src = "img/denglutu.png" />
		    		<div class ="dengluk">
		    			<div class = "dltop">
		    				<p>新用户注册<a href="login.html">已有账号</a></p>
		    			</div>
		    			<div class = "kk">
		    			<input class = "k0" type = "text" value="请输入正确的手机号" />
		    			<input  class = "k1" type = "text" placeholder="请输入以字母开头6位以上的用户名"/>
		    			<input  class = "k2" type = "text" placeholder="请输入密码"/>
		    			<input  class = "k3" type = "text" placeholder="请确认密码"/>
		    			<input  class = " yanzhengma" type = "text"  value = "验证码"/><input   type = "button"  class= "hqyzm" value = "获取验证码" />
		    			
		    			<input  class = "k6" type = "button" style = "background: #FF3366;border: none" value="注册"/>
		    			</div>
		    		<div class = "dlbottom">
		    <div class = "jizhuwo"><input type = "checkbox" value = "">同意<span class = "fontcolor">美丽说条款</span></div>
		  
		    		</div>
		    		
		    		</div>
		    	</div>
			
		    </div>
			
		<!-----------footer----------------------->
		<div class ="footer">
			<div class = "wrap">
				<div class="ftop">
					
				
				<ul>
					<h3>买家帮助</h3>
					<li><a href="">新手指南</a></li>
					<li><a href="">服务保障</a></li>
					<li><a href="">常见问题</a></li>
					<li><a href="">风险监测</a></li>
				</ul>
				<ul>
					<h3>商家帮助</h3>
					<li><a href="">商家入驻</a></li>
					<li><a href="">商家后台</a></li>
					
				</ul>
				<ul>
					<h3>关于我们</h3>
					<li><a href="">关于美丽说</a></li>
					<li><a href="">联系我们</a></li>
					
				</ul>
				<ul>
					<h3>关注我们</h3>
					<li><span></span><a href="">新浪微博</a></li>
					<li><span></span><a href="">qq空间</a></li>
					<li><span></span><a href="">腾讯微博</a></li>
					
				</ul>
				<dl>
					<dt><h3>美丽说微信服务号</h3></dt>
					<dd><img src="img/7e_61hjl8kjfjfagkg3cdaj05fghck9c_100x100.png"</dd>
				</dl>
				<dl>
					<dt><h3>美丽说客户端下载</h3></dt>
					<dd><img src="img/7e_74j23d2a5f5j3bj31h70375gbeec1_100x100.png"</dd>
				</dl>
				</div>
				<div class="foo">
		Copyright ©2017 Meilishuo.com &nbsp;<a href="http://s16.mogucdn.com/new1/v1/bmisc/518ea1bbd36948b90e658485d2700e62/181714310539.pdf" target="_blank">电信与信息服务业务经营许可证100798号</a>&nbsp;<a href="http://s16.mogucdn.com/p1/160811/idid_ifrtszjqmmzdazrumezdambqhayde_2436x3500.jpg" target="_blank">经营性网站备案信息</a>&nbsp; <br> 京ICP备11031139号&nbsp; 京公网安备110108006045&nbsp;&nbsp; 客服电话：4000-800-577&nbsp; 文明办网文明上网举报电话：010-82615762 &nbsp;<a href="http://net.china.com.cn/index.htm" target="_blank">违法不良信息举报中心</a>		
				</div>
			</div>
		</div>

	</body>
	
</html>
